package com.ruoyi.dto;

import com.ruoyi.vo.ItemKvVO;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class DetailPage {
    private String title;
    private String businessName;
    private String busiId;
    private String taskId;
    private String procDefName;
    private boolean returnBtn;
    private boolean completeBtn;
    private boolean assignTasksBtn; //分配任务按钮
    private boolean deputySecretaryBtn; //是否需要副书记审批
    private boolean assigneeBtn1; //指定下级审批人(单选)
    private boolean circulateBtn; //已阅按钮
    private boolean fileSaveBtn; //归档按钮
    private boolean undertakeBtn; //承办批注按钮
    private boolean undertakingResultsBtn; //办理结果按钮

    private boolean doSendDocumentPassOnBtn; //发文转交
    private boolean doSendDocumentDistributeBtn; //发文分发
    private boolean doTakeDocumentDistributeBtn; //收文分发
    private boolean doAssignSubordinateOperatorsBtn; //设置下级审批人
    private boolean doTakeDocumentPassOnBtn; //收文转交
    private boolean dispatchTaskBtn; //指派按钮
    private List<FlowableButton> buttons; //指派按钮

    private String status;
    private String statusLabel;
    private String statusLabelType;
    private String startUserName;
    private String startUserDept;
    private List<ItemKvVO> keyValList;
    private String files;
    private Map<String, Object> flowRecord;
    private Map<String, Object> VariableMap;


    private List<TMeetingTopicDTO> meetingTopicList;

    public DetailPage addItem(String label, String value) {
        return this.addItem(label,  value,  "text");
    }
    public DetailPage addItem(String label, String value, String type) {
        if(keyValList == null){
            keyValList = new ArrayList<>();
        }
        keyValList.add(new ItemKvVO(label,  value,  type));
        return this;
    }

    public List<FlowableButton> getButtons() {
        this.buttons = new ArrayList<>();
        if(completeBtn){
            buttons.add(new FlowableButton("success","el-icon-edit-outline","completeBtn","审核"));
        }
        if(returnBtn){
            buttons.add(new FlowableButton("warning","el-icon-refresh-left","returnBtn","退回"));
            buttons.add(new FlowableButton("danger","el-icon-circle-close","rejectBtn","驳回"));
        }
        if(assignTasksBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","assignTasksBtn","分配任务"));
        }
        if(deputySecretaryBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","deputySecretaryBtn","是否要副书记审批"));
        }
        if(assigneeBtn1){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","assigneeBtn1","指定审批人"));
        }
        if(circulateBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","circulateBtn","已阅"));
        }

        if(fileSaveBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","fileSaveBtn","归档"));
        }
        if(undertakeBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","undertakeBtn","承办批注"));
        }
        if(undertakingResultsBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","undertakingResultsBtn","办理结果"));
        }
        if(doSendDocumentPassOnBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","doSendDocumentPassOnBtn","发文转交"));
        }
        if(doSendDocumentDistributeBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","doSendDocumentDistributeBtn","发文分发"));
        }
        if(doAssignSubordinateOperatorsBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","doAssignSubordinateOperatorsBtn","设置下级审批人"));
        }
        if(doTakeDocumentPassOnBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","doTakeDocumentPassOnBtn","收文转交"));
        }
        if(doTakeDocumentDistributeBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","doTakeDocumentDistributeBtn","收文分发"));
        }
        if(dispatchTaskBtn){
            buttons.add(new FlowableButton("primary","el-icon-edit-outline","dispatchTaskBtn","指派"));
        }
        return buttons;
    }
}
